<?php

/**
 * @Author: Wang chunsheng  email:2192138785@qq.com
 * @Date:   2023-04-27 15:14:40
 * @Last Modified by:   Wang chunsheng  email:2192138785@qq.com
 * @Last Modified time: 2023-05-22 17:19:41
 */

declare(strict_types=1);

namespace Common\WebSocket\Utility;

use Common\Helpers\DebugHelper;
use Common\Sign\CodeConst;
use Common\Sign\ProjectSign;
use Common\Sign\SignException;
use ErrorException;
use Psr\Http\Message\ResponseInterface;

/**
 * 基于项目的签名验证
 * @date 2023-05-21
 * @example
 * @author Wang Chunsheng
 * @since
 */
class VerifyProject
{
    /**
     * @throws ErrorException
     */
    public static function verifySign(array $Arg): array
    {
        $Sign = new ProjectSign();
        $Res = $Sign->checkParams($Arg);
        if($Res['code'] === (int) CodeConst::CODE_90010){
            return $Sign->validateSign($Arg);
        }else{
            return $Res;
        }
    }
}
